<div class="g-bd clearfix">
       <div class="fcj_menu clearfix">
    		<b class="spbg2 corner tl"></b>
    		<b class="spbg2 corner tr"></b>
    		<b class="spbg2 corner bl"></b>
    		<b class="spbg2 corner br"></b>
    		<h2 class="titlebar clearfix">YOUR SHIPPING OPTIONS</h2>
    		<div class="order-ship-opt">
				<h3>Congratulation! You qualify for free standard shipping!</h3>
                <div>Delivery times are calculated in business days for orders placed before 1PM Pacific Standard Time.</div>
                <div class="o-opts">
                	<?php if ($this->yunfeiArray):?>
                		<?php $i = 0;?>
                		<?php foreach($this->yunfeiArray as $value):?>
                			<?php $i++;?>
                			<?php if ($value['openflag']):?>
                			<div><input type="radio" name="yunfeiid" value="<?php echo $value['pid']?>" id="shipOptItem<?php echo $i;?>" onclick="changeyunfei(this);"/><label for="shipOptItem1"><a target="_blank" title="<?=$value['carrier']?>" href="<?=$value["yurl"]?>"><?php echo $value['carrier'];?></a> <?php echo $value['transittime'];?> Business Day Shipping - 
                			<?php if ($value['price']==0.00):?>
			        			<span>Free!</span>
							 <?php else:?>
							    $<?=$value['price']?>
							  <?php endif;?>
							 </label></div>
                			<?php endif;?>
                    	<?php endforeach;?>
                    <?php else:?>
                    		<div><input type="radio" name="yunfeiid" id="shipOptItem1" value="0" onclick="changeyunfei(this);"/><label for="shipOptItem1">Standard Shipping - <span>FREE!</span> </label></div>
                    <?php endif;?>   
                    <input type="hidden" name="contactid" id="contactid" value="<?php echo $this->contactid;?>"></input>                 
                </div>
               
    		</div>
            <div id="pay_info"></div>            
    		       
        </div>
    </div>
<script>
$('input[name="yunfeiid"]').first().click();
load_pay($('input[name="yunfeiid"]').first().val());
$(function(){
	$('#paypal_email').hide();
});

function changeyunfei(obj)
{
	if ($(obj).attr('checked') == true) {
		load_pay($(obj).val());
	}
}

function load_pay(id)
{
	GGSHOP.loading.show();
	$.ajax({
		type: "POST",
		url: "/product-paymoney",
		data: {contactid: $('#contactid').val(), yunfeiid: id},
		success: function(data) {	
			GGSHOP.loading.hidden();				
			$('#pay_info').html(data);
		}			
	});
}

function confirmCancel(){

	if(confirm("Sure to cancel this order?")){

		return true;

	}else{

		return false;

	}

}
function dopay(){

	var hasSelect=false;
	var pay = '';
	$('input[name="paymentMethod"]').each(

		function(){

			if($(this).attr('checked')==true){
				pay = $(this).val();
				hasSelect=true;
			}

		}

	);

	if(!hasSelect){

		GGSHOP.msgBox.show('ERROR', 'Please select a payment method!');

		$('#paymentForm').submit(

			function(){

				return false;

			}

		);

	}else{
		if (pay == 'paypal' && ($('#paypal_email_text').val() == '' || $('#paypal_email_text').val() == 'YourMail@email.com')) {
			
			GGSHOP.msgBox.show('ERROR', 'Please input your email!');
			$('#paymentForm').submit(
					function(){
						return false;
					}
			);
			return;
		}
		$('#paymentForm')[0].submit();

		GGSHOP.loading.show();

	}

}



var payment={

	changeToPaypal:function(){		
		$('input[name="payment_action"]').val('pay-paypal');
		$('#paypal_email').show();
	},

        changeTossfkh:function(){
		$('input[name="payment_action"]').val('pay-ssfkh');
		$('#paypal_email').hide();

	},

        changeTossfkhnopass:function(){

		$('#paymentForm').attr('action','pay-nopassssfkh');
		$('#paypalinfo').hide();
	},

	changeToWest:function(){

		$('#paymentForm').attr('action','pay-west');

	},

	changeToTT:function(){

		$('#paymentForm').attr('action','pay-tt');

	}

}
</script>